Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reset repo feature #211

Merged
merged 22 commits into from
Sep 11, 2023
Merged

Reset repo feature #211

merged 22 commits into from
Sep 11, 2023

Conversation

rmunn
Copy link
Contributor

@rmunn rmunn commented Jul 27, 2023

WIP on reset repo feature. Currently have UI and backend, but UI not yet hooked up to backend.

related to #155

@rmunn rmunn linked an issue Jul 27, 2023 that may be closed by this pull request
@github-actions
Copy link

github-actions bot commented Jul 27, 2023

UI unit Tests

1 tests  ±0   1 ✔️ ±0   0s ⏱️ ±0s
1 suites ±0   0 💤 ±0 
1 files   ±0   0 ±0 

Results for commit 320c22e. ± Comparison against base commit b2c778b.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Jul 27, 2023

Unit Tests

0 tests   - 8   0 ✔️  - 8   0s ⏱️ -7s
0 suites  - 3   0 💤 ±0 
0 files    - 1   0 ±0 

Results for commit c7a22e2. ± Comparison against base commit 2ce46b3.

♻️ This comment has been updated with latest results.

@rmunn
Copy link
Contributor Author

rmunn commented Jul 27, 2023

Still to do: actually downloading the zip file. Also, figuring out where on the project page to place the reset button; I just arbitrarily put it above the Mercurial history, but I think we want a red "Danger" area with buttons like this.

@rmunn
Copy link
Contributor Author

rmunn commented Jul 27, 2023

One UI issue that bugs me:

bugs-me

Shouldn't the checkbox be on the left?

@rmunn
Copy link
Contributor Author

rmunn commented Jul 27, 2023

Also to do: need to verify whether the .zip file produced by .NET Core will handle UTF-8 filenames correctly, because audio files in FLEx projects will often have names in the target language (which will often be a non-Roman script). If the functions built into .NET Core can't handle UTF-8 filenames correctly, we'll have to use 7zip (found in the 7z command on Linux) to do the zipping.

@rmunn
Copy link
Contributor Author

rmunn commented Jul 27, 2023

Looks like the ZipFile.CreateFromDirectory method does indeed handle UTF-8 filenames correctly: I made a test project and created a zip file with a filename full of non-Roman characters, and the resulting zip file had the correct filename in UTF-8 inside (confirmed by taking a hex dump of the first hundred or so bytes of the .zip file). So there's no need to reach for an external tool.

We used 7zip in Language Forge because at the time, Windows 7 was the most recent version of Windows and it still had a bug handling non-Roman filenames in zip files. But that bug has been fixed in Windows 10, and as long as we're using recent versions of .NET, there's no problem using the built-in zip file handlers on Unicode filenames.

@rmunn
Copy link
Contributor Author

rmunn commented Jul 27, 2023

Note that once we're using .NET 8, we'll be able to use ZipFile.CreateFromDirectory without creating a temporary file. Which will reduce some code complexity and potentially save some time.

@alex-larkin
Copy link

Yes, I think that the left side would be more intuitive, and a better design choice.

Modal dialog in UI currently does nothing, I'll hook it up next
@myieye
Copy link
Contributor

myieye commented Aug 11, 2023

We've agreed that we'll initially backup deleted (also repos that have been deleted as part of reseting them) into a "fake repo" called "deleted". Repos that are explicitly deleted are suffixed with the deletion timestamp i.e. {project-code}__{deleted-at}. In order to differentiate between those and repos that have been reset, reset repos should do something slightly different such as {project-code}__{deleted-at}__reset.

The HgService has a SoftDeleteRepo(string code, string deletedRepoSuffix) method ready for this.
See: #212 (comment)

@myieye
Copy link
Contributor

myieye commented Aug 12, 2023

One UI issue that bugs me:

bugs-me

Shouldn't the checkbox be on the left?

@rmunn yeah, it appears to me that the vast majority of forms with a checkbox have the checkbox on the left with the text immediately to the right of it (rather than the text being justified to the far right of the form). I think that would be an improvement for our Checkbox component. The only other place we use it (I think) is the project creation page. Perhaps make sure it looks ok there as well. Great work!!

Checkbox now looks correct, and label has enough spacing
It will now actually reset the project.
@rmunn rmunn changed the title Reset repo feature (WIP) Reset repo feature Aug 18, 2023
@rmunn rmunn marked this pull request as ready for review August 18, 2023 08:27
Now that we're using the accent color, it clashes in both color and
look. The button's distinct color is enough.
Now that the code is wrapped in {#if project}, we don't need to write
`project?.code` because we know it's defined at that point.
@rmunn
Copy link
Contributor Author

rmunn commented Aug 24, 2023

I believe I've addressed all of @myieye's review comments. @hahn-kev, would you like to review it again since @myieye is out of the office at the moment? It's been a couple of weeks since it was looked at, so I think another look might be good before we merge it.

@rmunn rmunn requested a review from myieye August 24, 2023 07:50
@rmunn rmunn requested a review from hahn-kev August 24, 2023 07:50
Copy link
Collaborator

@hahn-kev hahn-kev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks great Robin, thanks.
There's some minor changes I'd like to the API used to reset the project. I'd also like to see us use the FormModal and then have the user type in reset before we actually let the run the reset. Could also verify they clicked the download link too actually.

@github-actions
Copy link

github-actions bot commented Sep 1, 2023

C# Unit Tests

8 tests   8 ✔️  10s ⏱️
3 suites  0 💤
1 files    0

Results for commit 320c22e.

♻️ This comment has been updated with latest results.

We'll use an object, not a string, as the return value, to make it
easier to add other fields later if desired.
Now that we're reusing the SoftDelete method, which doesn't return
anything, there's no backupPath to return. It was never all that
meaningful to the end user anyway, so just get rid of it and simply
return an empty HTTP 200 to indicate success.
Also move the business logic inside the modal, rather than in the page,
similarly to how AddProjectMember and ChangeMemberRole work.
If the repo directory cannot be found, HgService.BackupRepo will return
null for the backup file path, which will turn into a 404 in the
ProjectController. We'll want to detect that 404 in the UI when the user
clicks on the "Backup Project" button and disallow submitting the form
if that happens.
@rmunn
Copy link
Contributor Author

rmunn commented Sep 7, 2023

Merge conflicts resolved (by merging develop into the branch), all review discussions (so far) resolved as well. Time for a re-review in case the merge did something weird, then this will finally be ready to merge!

@rmunn rmunn requested a review from hahn-kev September 7, 2023 08:37
Copy link
Contributor

@myieye myieye left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lots of nit picks 😉

Copy link
Contributor

@myieye myieye left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rmunn looks good! 👍🏽
I implemented and pushed all my feedback.
You should probably look it over.

Copy link
Collaborator

@hahn-kev hahn-kev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. I created #275 to track some features that we decided not to implement yet.

@hahn-kev hahn-kev merged commit 13845e3 into develop Sep 11, 2023
11 checks passed
@myieye myieye deleted the feature/reset-repo branch October 5, 2023 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

project reset history feature
4 participants